#!/bin/bash

script_rootdir=`dirname $0`
lib_rootdir=$script_rootdir/../lib
ftest_rootdir=$script_rootdir/../ftest

IGNORE_FILE=$ftest_rootdir/_ignore.list

## -------------------------------------------------------
## isIgnored() - checks whether a function is defined in
##      $IGNORE_FILE
## INPUT: a function that is in $lib_rootdir
## OUTPUT: 1 if it is defined in $IGNORE_FILE. O otherwise
## -------------------------------------------------------

isIgnored()
{
  local ftest2check=$1
  local retval=0

  retval=`grep -c $ftest2check $IGNORE_FILE`  

  echo $retval
} ## END: isIgnored()


for each_func in $(find $lib_rootdir/*|grep bash.inc); do
    funcname=$(basename $each_func)
    ftest_name=$(echo $funcname|cut -d'.' -f1).test

    if [ "$(isIgnored $funcname)" = "1" ]; then
      echo -n '*[OK] - '
    else
      [[ -e $ftest_rootdir/$ftest_name ]] && echo -n ' [OK] - ' || echo -n '>>> [missing] - '
    fi
    echo "`basename $each_func`"
done

echo "
NOTE: *[OK] - means that this function is ignored/no function tests planned for the short term
"
